<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>主页</title>
    <script th:src="@{/asserts/bower_components/jquery/dist/jquery.min.js}"></script>
</head>
<body>
<a th:href="@{/echarts/campus}">返回json数据</a>
</body>
<script>
    window.onload = function () {
        var names = [];
        var values = [];
        $.ajax({
            url: "echarts/campus",
            type: "post",
            async: true,
            data: {},
            dataType: "json",
            success: function (result) {
                if (result) {
                    for (var key in result) {
                        console.log(key);
                        console.log(result[key]);
                        names.push(key);
                        values.push(result[key]);
                    }
                }
                console.log(names);
                console.log(values);
            }
        })
    }
</script>
</html>